package cn.lger.controller;

import cn.lger.pojo.Temp;
import cn.lger.service.TempService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Code that Changed the World
 *
 * @author Pro
 * @date 2018-06-13.
 */

@Controller
@Api(tags = "临时控制器")
public class TempController {

    @Resource
    private TempService tempService;

    @GetMapping("/temp")
    public String getTemp(){
        return "temp";
    }

    @GetMapping("/temp/del")
    public String deleteTemp(int id){
        tempService.deleteTempById(id);
        return "temp";
    }

    @GetMapping("/temp.json")
    @ResponseBody
    @ApiOperation(httpMethod = "GET", value = "个人信息")
    @ApiResponse(code = 200, message = "成功", response = Temp.class)
    public Temp getTempJson(@ApiParam(required = true, name = "id", value = "id") @RequestParam int id){
        return tempService.findTempById(id);
    }


}
